﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using Aliyeye.Car.Net.UI.Components;

namespace Aliyeye.Car.Net.UI.AdminCustomer
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
        }

        private void Form1_Load(object sender, EventArgs e)
        {
            this.pager1.PageCurrent = 1;
            this.pager1.Bind();
        }
        private int dgvBind()
        {
            PageData pageData = new PageData();
            pageData.TableName = "Accounts_Roles left join Accounts_Permissions on Accounts_Permissions.PermissionID=Accounts_Roles.RoleID";
            pageData.PrimaryKey = "Accounts_Permissions.PermissionID";
            pageData.OrderStr = "Accounts_Permissions.PermissionID desc";
            pageData.PageIndex = this.pager1.PageCurrent;
            pageData.PageSize = this.pager1.PageSize;
            pageData.QueryCondition = "";
            pageData.QueryFieldName = "Accounts_Permissions.Description,Accounts_Permissions.PermissionID,Accounts_Roles.Description";

            this.pager1.bindingSource.DataSource = pageData.QueryDataTable().Tables[0];
            this.pager1.bindingNavigator.BindingSource = pager1.bindingSource;
            //dataGridView1.AutoGenerateColumns = false;

            gvdlist.DataSource = this.pager1.bindingSource;
            return pageData.TotalCount;
        }

        private int pager1_EventPaging(EventPagingArg e)
        {
            return dgvBind();
        }
    }
}
